package yh.design.factorysimple;

import yh.design.factorysimple.impl.CashPayment;
import yh.design.factorysimple.impl.UnionPayment;
import yh.design.factorysimple.impl.VipCardPayment;
import yh.design.factorysimple.impl.WechatPayment;

/**
 * @author: zyh
 * @date: 2025/4/13 01:14
 **/
public class PaymentFactory {


    public static AbstractPayment createPayment(Integer payType){
        switch (payType){
            case 1:
               return new CashPayment();
            case 2:
                return new UnionPayment();
            case 3:
                return new VipCardPayment();
            case 4:
                return new WechatPayment();
            default:
                return null;
        }
    }

    public static void main(String[] args) {
        //账户现金支付
        AbstractPayment payment = PaymentFactory.createPayment(1);

    }
}
